﻿<?php

defined('SYSPATH') or die('No direct script access.');

class Controller_Search extends Controller_Site {

    public function action_index() {
        ///////////////////////
	if(isset($_POST['submit'])){
		
        $result = ORM::factory('files')->where('FileName', '=', $_POST["search"])->find_all();
        
        ////////////////////////
        
        $this->content->set('result', $result);
	}
        
        //statisztikák lekérdezése
        $NumFiles = ORM::factory('stats')->where('Name', '=', 'NumFiles')->find();
        $NumFolders = ORM::factory('stats')->where('Name', '=', 'NumFolders')->find();
        $NumSearch = ORM::factory('stats')->where('Name', '=', 'NumSearch')->find();
        $FullSize = ORM::factory('stats')->where('Name', '=', 'FullSize')->find();
        
        $this->content
                ->set('NumFiles', $NumFiles)
                ->set('NumFolders', $NumFolders)
                ->set('NumSearch', $NumSearch)
                ->set('FullSize', $FullSize);
    }
}
